package com.lzc.listener;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component // 被spring管理
public class ListenerOnStartEvent implements ApplicationListener<StartEvent>{

    // 获取事件 执行方法
    @Override
    public void onApplicationEvent(StartEvent event) {
        System.out.println(event.getSource());
    }
}
